const express = require('express');
const app = express();
app.use((req,res,next)=>{
    res.setHeader('Access-Control-Allow-Origin','*');
    next();
})
app.use(express.urlencoded({extended:false}));
app.get('/ajaxserver',(req,res)=>{
    // 查询字符串
    console.log(req.query);
    let data = {
        name:"小李",
        age:19
    }
    res.send(data);
});
app.post('/ajaxserverpost',(req,res)=>{
    console.log(req.body);
    let data = {
        name:"postname",
        age:19
    }
    res.send(data);
});

app.listen(80,()=>{
    console.log("启动");
});